package com.nnnu.wsnackshop.pojo.entity;

import com.baomidou.mybatisplus.annotation.*;

import java.time.LocalDateTime;
import java.io.Serializable;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

/**
 * <p>
 * 商品表
 * </p>
 *
 * @author zk
 * @since 2025-05-14
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("products")
public class Products implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 商品ID
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    /**
     * 门店ID，关联 stores.id
     */
    private Integer storeId;

    /**
     * 分类ID，关联 categories.id
     */
    private Integer categoryId;

    /** 由 brandId 关联品牌表 */
    private Integer brandId;

    /**
     * 商品名称
     */
    private String name;

    /**
     * 描述
     */
    private String description;

    /**
     * 主图URL
     */
    private String mainImage;

    /**
     * 商品多图URL（JSON数组）
     */
    private String images;

    /**
     * 状态：0=inactive,1=active
     */
    private Integer status;

    /**
     * SPU ID
     */
    private Integer spuId;

    /** 创建时间 */
    @TableField(value = "created_at", fill = FieldFill.INSERT)
    private LocalDateTime createdAt;

    /** 更新时间 */
    @TableField(value = "updated_at", fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updatedAt;

    /** 销量 (非数据库字段) */
    @TableField(exist = false)
    private Integer salesCount;
}
